package com.glodon.paas.account.dao.mysql;

import org.springframework.beans.factory.annotation.Autowired;

import com.glodon.paas.account.dao.CompanyDao;
import com.glodon.paas.account.dao.domain.CompanyEntity;
import com.glodon.paas.account.dao.mapper.CompanyEntityMapper;

public class CompanyDaoMysqlImpl   implements CompanyDao {
	@Autowired
	private CompanyEntityMapper companyEntityMapper;
	
	@Override
	public String insert(CompanyEntity entity) {
		companyEntityMapper.insertSelective(entity);
		return entity.getId();
	}

	@Override
	public CompanyEntity get(String id) {
		return companyEntityMapper.selectByPrimaryKey(id);
	}

	@Override
	public int delete(String id) {
		return companyEntityMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(CompanyEntity address) {
		companyEntityMapper.updateByPrimaryKeySelective(address);		
	}
}
